package com.atguigu.gmall.payment.listener;

import com.atguigu.gmall.common.constant.MqConst;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author: 李旭
 * @create: 2021-09-17 10:41
 **/
@Component
public class PaymentListener {




    //关闭交易
    @RabbitListener(queues = MqConst.QUEUE_PAYMENT_CLOSE)
    public void receiverMessage(Long orderId, Channel channel, Message message) {
        try {
            System.out.println("订单ID：" + orderId);//



            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
